﻿package mortal.game.net.command.copy
{
    import Framework.MQ.*;
    import Message.Command.*;
    import Message.DB.Tables.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.game.resource.*;
    import mortal.mvc.core.*;

    public class CopyCommand extends BroadCastCall
    {

        public function CopyCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:SCopyPassInto = null;
            var _loc_3:TCopy = null;
            var _loc_4:TCopy = null;
            super.call(param1);
            switch(param1.messageHead.command)
            {
                case EPublicCommand._ECmdPublicCopyPassInto:
                case EPublicCommand._ECmdPublicCopyRePassInto:
                {
                    _loc_2 = param1.messageBase as SCopyPassInto;
                    _loc_3 = CopyConfig.instance.getCopyInfoByCode(_loc_2.copyCode);
                    _cache.copy.copyInfo = _loc_3;
                    if (_loc_3.type == ECopyType._ECopyTypeGuildManor)
                    {
                        Cache.instance.guild.curInsideGuildId = _loc_2.copyId.id;
                    }
                    NetDispatcher.dispatchCmd(ServerCommand.Copy_EnterCopy, _loc_2.copyCode);
                    break;
                }
                case EPublicCommand._ECmdPublicCopyLeft:
                {
                    _loc_4 = _cache.copy.copyInfo;
                    _cache.copy.copyInfo = null;
                    NetDispatcher.dispatchCmd(ServerCommand.Copy_LeaveCopy, _loc_4);
                    Cache.instance.guild.curInsideGuildId = 0;
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }// end function

    }
}
